{extend name="$_admin_base_layout" /}
{block name="body"}
<div class="container-fluid" style="padding-top: 10px; background-color: rgb(240, 242, 245);">
    <div class="row">
        <div class="pull-left">
            <ul class="nav nav-pills">
                <li class=""><a href="{:url('index')}"><i
                        class="icon icon-reply"></i> 返回</a></li>
                <li class="" style="padding-left: 0; padding-right: 0; padding-top: 8px;">
                    <strong style="border-left: 1px solid #ddd;display: inline-block; padding-left: 15px;">{$meta_title}</strong>
                    [{$info.title}]
                </li>
            </ul>
        </div>
    </div>
    <form action="{:url('data')}" class="form-horizontal" method="post">

        <div class="panel panel-auth-group" style="margin-bottom: 0;">
            <div class="panel-heading">
                <label class="checkbox-inline" style="padding-left: 0;">
                    <strong>数据范围</strong>
                </label>
            </div>
            <div class="panel-body">

                <div>
                    {html:radio name="data_type" options="data_type_list" checked="data_type" clazz="radio-inline radio-data-type"/}
                </div>

                {notempty name="data_list"}
                <div id="data-detail" class="data_detail {$data_type== '3'? 'show':'hide'}">
                    <hr/>
                    {volist name="data_list" id="data"}
                    <label class="checkbox-inline2"> <input
                            class="auth_datas datas_row" type="checkbox" name="datas[]" value="{$data.id}"
                            {$data.checked}>
                        {$data.title}
                    </label>

                    {/volist}
                </div>
                {else/}
                <p style="margin-bottom: 0;" class="text-center">aOh! 该菜单下暂时还没有内容!</p>
                {/notempty}
            </div>
        </div>


        <div class="panel panel-auth-group" style="margin-bottom: 0; margin-top: 10px;">
            <div class="panel-body">
                <input type="hidden" name="id" value="{$info.id|default=''}">
                <button class="btn btn-primary ajax-post" type="submit" data-href="form-horizontal">
                    <i class="icon icon-save"></i> 保存
                </button>
                <a class="btn btn-default" href="{:url('index')}">
                    <i class="icon icon-undo"></i> 返回
                </a>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script>
    $(function () {
        $('.panel-heading .btn-select-all').click(function () {
            $panel = $(this).parents('.panel-auth-group');
            $panel.find("input[type='checkbox']").prop('checked', true);
        });
        $('.panel-heading .btn-cancel-all').click(function () {
            $panel = $(this).parents('.panel-auth-group');
            $panel.find("input[type='checkbox']").prop('checked', false);
        });

        $('.btn-data-row').click(function () {
            $panel = $(this).parents('.data_check');
            if ($(this).is(':checked')) {
                $panel.dataren('.data_row').find("input[type='checkbox']").prop('checked', true);
            } else {
                $panel.dataren('.data_row').find("input[type='checkbox']").prop('checked', false);
            }
        });
        $('.radio-data-type>input').click(function () {
            var val = $(this).val();
            if (val == 3){
                $('#data-detail').show();
            }else{
                $('#data-detail').hide();
            }
        });
    });

</script>
{/block}
{block name="style"}
<style>
    .checkbox-inline2 {
        width: 200px;
        display: inline-block;
        font-weight: normal;
        position: relative;
        font-weight: 400;
        vertical-align: middle;
        cursor: pointer;

    }
</style>
{/block}